#include <iostream>
#include <sstream>
#include <SFML/Graphics/RenderWindow.hpp>
#include <nice2d/macros.h>
#include <nice2d/scene.h>
#include <nice2d/sprite.h>
#include <nice2d/imagedescriptor.h>
#include <nice2d/animation.h>
#include <nice2d/background.h>

#define SCENE_WIDTH  800.0f
#define SCENE_HEIGHT 600.0f

class UnitScene : public Scene
{
public:
    void onInitialed()override
    {
        setBackground(Background::create(sf::Color::Green));
        setSceneBox({0.0f, 0.0f, SCENE_WIDTH, SCENE_HEIGHT});

        auto descriptor = std::make_shared<ImageDescriptor>();
        descriptor->load("./../data/animation/blast2.xml");

        auto animation = std::make_shared<Animation>();
        animation->setImageDescriptor(descriptor);
        animation->setBackgroundColor(sf::Color::Transparent);
        animation->setCenter(400.0f, 300.0f);
        animation->setSingleShot(false);
        animation->setDurationPerFrame(0.6f);
        animation->start();
        addChild(animation);
    }
private:
};

DECLARE_MAIN_FUNCTION_WITH_SCENE(SCENE_WIDTH, SCENE_HEIGHT, "unit08", UnitScene)
